package com.heima.article.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.heima.model.article.pojos.ApArticle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author brianxia
 * @version 1.0
 * @date 2022-11-10 11:36
 */
@Mapper
public interface ArticleMapper extends BaseMapper<ApArticle> {
    List<ApArticle> load(
            IPage<ApArticle> page,
            @Param("size") Integer size,
            @Param("tag") String tag,
            @Param("maxBehotTime") Date maxBehotTime,
            @Param("minBehotTime") Date minBehotTime,
            @Param("type") Short type);


    void updateLikes(@Param("articleId") Long articleId);

    List<ApArticle> selectArticlesByDate(@Param("date") Date date);

    List<ApArticle> selectArticlesByDatePartition(@Param("date") Date date
            , @Param("total") int total
            , @Param("index") int index
    );

    void updateBehavior(@Param("articleId") Long articleId,
                        @Param("view")int view,
                        @Param("comment")int comment,
                        @Param("collect")int collect,
                        @Param("like")int like);
}
